package com.example.demo.pojos;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.List;
import java.util.Objects;

@Entity
public class Fix {
    private int fixId;
    private int fixState;
    private int fixReceiveMoney;
    private Timestamp fixYjjfdate;
    private Timestamp fixSjjfdate;
    private User wxr;
    private Fixcheck wxjcb;


    @Id
    @Column(name = "fix_ID", nullable = false)
    public int getFixId() {
        return fixId;
    }

    public void setFixId(int fixId) {
        this.fixId = fixId;
    }

    @Basic
    @Column(name = "fix_state", nullable = false)
    public int getFixState() {
        return fixState;
    }

    public void setFixState(int fixState) {
        this.fixState = fixState;
    }

    @Basic
    @Column(name = "fix_receiveMoney", nullable = false, precision = 0)
    public int getFixReceiveMoney() {
        return fixReceiveMoney;
    }

    public void setFixReceiveMoney(int fixReceiveMoney) {
        this.fixReceiveMoney = fixReceiveMoney;
    }

    @Basic
    @Column(name = "fix_yjjfdate", nullable = false)
    public Timestamp getFixYjjfdate() {
        return fixYjjfdate;
    }

    public void setFixYjjfdate(Timestamp fixYjjfdate) {
        this.fixYjjfdate = fixYjjfdate;
    }

    @Basic
    @Column(name = "fix_sjjfdate", nullable = false)
    public Timestamp getFixSjjfdate() {
        return fixSjjfdate;
    }

    public void setFixSjjfdate(Timestamp fixSjjfdate) {
        this.fixSjjfdate = fixSjjfdate;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Fix fix = (Fix) o;
        return fixId == fix.fixId &&
                fixState == fix.fixState &&
                fixReceiveMoney == fix.fixReceiveMoney &&
                Objects.equals(fixYjjfdate, fix.fixYjjfdate) &&
                Objects.equals(fixSjjfdate, fix.fixSjjfdate);
    }

    @Override
    public int hashCode() {
        return Objects.hash(fixId, fixState, fixReceiveMoney, fixYjjfdate, fixSjjfdate);
    }

    @ManyToOne
    @JoinColumn(name = "fix_fixpeopleID", referencedColumnName = "uid", nullable = false)
    public User getWxr() {
        return wxr;
    }

    public void setWxr(User wxr) {
        this.wxr = wxr;
    }

    @OneToOne
    @JoinColumn(name = "fix_checkID", referencedColumnName = "fc_ID", nullable = false)
    public Fixcheck getWxjcb() {
        return wxjcb;
    }

    public void setWxjcb(Fixcheck wxjcb) {
        this.wxjcb = wxjcb;
    }
}
